<?php

use think\migration\Migrator;
use think\migration\db\Column;


class CreateOpinionFeedback extends Migrator
{
    public function up()
    {
        $table = $this->table('opinion_feedback', ['signed'=>false,'comment' => '意见反馈表']);
        $table->addColumn('user_id', 'integer', ['limit' => 10, 'comment' => '用户id'])
            ->addColumn('back_type', 'integer', ['limit' => 1, 'comment' => '反馈类型 1用户 2跑男'])
            ->addForeignKey('user_id', 'user', 'id', ['delete' => 'CASCADE'])
            ->addColumn('opinion', 'text', ['comment' => '意见'])
            ->addColumn('img_url', 'text', ['comment' => 'json格式图片地址'])
            ->addColumn('create_time', 'integer', ['limit'=>10,'signed'=>false,'comment' => '创建时间'])
            ->create();
    }

    public function down()
    {
        $this->dropTable('opinion_feedback');
    }
}
